package com.analysis.apresunday.service.impl;

import com.analysis.apresunday.mapper.AnalysisEducationMapper;
import com.analysis.apresunday.entity.po.AnalysisEducation;
import com.analysis.apresunday.service.AnalysisEducationService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import java.util.Collections;
import java.util.List;

@Service
public class AnalysisEducationServiceImpl extends ServiceImpl<AnalysisEducationMapper, AnalysisEducation> implements AnalysisEducationService {
    @Override
    public List<AnalysisEducation> getStatisticList() {
        QueryWrapper<AnalysisEducation> query = new QueryWrapper<>();
        query.orderByDesc("id");
        query.last("limit 7");
        List<AnalysisEducation> analysisEducations = baseMapper.selectList(query);
        // 通过倒叙 将顺序从学历不限开始
        Collections.reverse(analysisEducations);
        return analysisEducations;
    }
}
